package com.erpoa.service.impl;

import com.erpoa.annotation.DataBase;
import com.erpoa.constants.DataSourceNames;
import com.erpoa.mapper.PingzhiMapper;
import com.erpoa.service.IPingzhiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author chenjimin
 * @Title: PingzhiServiceImpl
 * @ProjectName oaerp
 * @Description: TODO
 * @date 2020/7/1616:02
 */
@Service
public class PingzhiServiceImpl implements IPingzhiService {

    private static final Logger logger = LoggerFactory.getLogger(PingzhiServiceImpl.class);
    @Autowired
    private PingzhiMapper pingzhiMapper;

    @Override
    @DataBase(DataSourceNames.PINGZHI)
    @Transactional()
    public String getSequence(String sequence) {
        HashMap map = this.pingzhiMapper.testCallProduce();



        return pingzhiMapper.getSequence(sequence);
    }

    @Override
    @DataBase(DataSourceNames.PINGZHI)
    @Transactional()
    public void createSequence(String sequence) {
          pingzhiMapper.createSequence(sequence);
    }

    @Override
    @DataBase(DataSourceNames.PINGZHI)
    @Transactional()
    public List<HashMap> selectDataWithfmachinecode(String ffactorycode,String fmachinecode,String fplanbegindate,String fplanenddate) {
       return pingzhiMapper.selectDataWithfmachinecode(ffactorycode,fmachinecode, fplanbegindate, fplanenddate);
    }

    @Override
    @DataBase(DataSourceNames.PINGZHI)
    @Transactional()
    public void dropSequence(String sequence) {
         pingzhiMapper.dropSequence(sequence);
    }

    @Override
    @DataBase(DataSourceNames.ERP)
    @Transactional
    public List<Map<String,Object>> selecttcpgenbyhrno(String hrno) {
        return pingzhiMapper.selecttcpgenbyhrno(hrno);
    }
}
